Skip to content

Add support for required html attribute#1332

Merged
Xon merged 15 commits intoChoices-js:mainfrom
zoglo:feat/invalid-state
Aug 16, 2025
Merged

Add support for required html attribute#1332
Xon merged 15 commits intoChoices-js:mainfrom
zoglo:feat/invalid-state

Conversation

@zoglo
Copy link
Copy Markdown
Contributor

@zoglo zoglo commented Aug 15, 2025

Description

This feature requires updating any css targeting the .choices [hidden] selector

This PR adds visual feedback on required fields by adding the class is-invalid on the invalid event (only when the input or select are required). Within a change, it will check again if our value is valid, thus removing the class.

I have updated the documentation accordingly and added a test-case and an update on the index.html (commented it out in fdf07fa and 83d2b0a as I sadly can't update the screenshots 😢). /cc @Xon 😊

This fixes, supersedes and implements:

Screenshots (if appropriate)

image image

Types of changes

  • Chore (tooling change or documentation change)
  • Refactor (non-breaking change which maintains existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project.
  • I have added new tests for the bug I fixed/the new feature I added.
  • I have modified existing tests for the bug I fixed/the new feature I added.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@Xon Xon added the feature Pull request that adds new functionality label Aug 16, 2025
@Xon Xon changed the title Add the invalidState for choices Add support for required html attribute Aug 16, 2025
@Xon Xon force-pushed the feat/invalid-state branch from 49c0909 to b624ad8 Compare August 16, 2025 15:51
@Xon
Copy link
Copy Markdown
Collaborator

Xon commented Aug 16, 2025

Thanks! This looks to be quite a straightforward change.

I did a rebase and pushed and fixed some of the merge conflicts from the asset files.

I'll re-enable those tests and update the image files once the e2e tests run

@zoglo
Copy link
Copy Markdown
Contributor Author

zoglo commented Aug 16, 2025

Thanks a lot @Xon 🚀

@Xon Xon merged commit 377523f into Choices-js:main Aug 16, 2025
11 checks passed
@zoglo zoglo deleted the feat/invalid-state branch August 16, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Pull request that adds new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants